<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增商品分类')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-goodsclass-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">分类名称：</label>
                <div class="col-sm-8">
                    <input name="className" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">所属类别：</label>
                <div class="col-sm-8">
                    <div class="radio-box">
                        <input type="radio" name="classType" value="服务">
                        <label th:for="classType" th:text="服务"></label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" name="classType" value="产品">
                        <label th:for="classType" th:text="产品"></label>
                    </div>
                </div>
            </div>
            <!--<div class="form-group">
                <label class="col-sm-3 control-label">分类编码：</label>
                <div class="col-sm-8">
                    <input name="classCode" class="form-control" type="text">
                </div>
            </div>-->
           <!-- <div class="form-group">
                <label class="col-sm-3 control-label">分类级别：</label>
                <div class="col-sm-8">
                    <input name="classLevel" class="form-control" type="text">
                </div>
            </div>-->
            <div class="form-group">    
                <label class="col-sm-3 control-label">上级：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="treeId" name="pid" type="hidden" th:value="${jjyhGoodsclass?.id}"/>
                        <input class="form-control" type="text" onclick="selectGoodsclassTree()" id="treeName" readonly="true" th:value="${jjyhGoodsclass?.className}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "jjyh/goodsclass"
        $("#form-goodsclass-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-goodsclass-add').serialize());
            }
        }

        /*商品分类-新增-选择父部门树*/
        function selectGoodsclassTree() {
            var options = {
                title: '商品分类选择',
                width: "380",
                url: prefix + "/selectGoodsclassTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
               $("#treeId").val(body.find('#treeId').val());
               $("#treeName").val(body.find('#treeName').val());
               layer.close(index);
        }
    </script>
</body>
</html>